# -*- coding: utf-8 -*-
import os
import subprocess
import datetime



# files = os.popen("cmd")
# todo：方式1
# os.system('ipconfig')
# todo:方式2
# p = os.popen('ipconfig')
# print("p.read(): {}\n".format(p.read()))

# todo：方式3

dir_path1 = os.path.join(r"E:\devcode\kzsny\wmp", "wmp-uca-web-main")
dir_path2 = os.path.join(r"E:\devcode\kzsny\wmp", "wmp-uca-web-ssoLogin")
dir_path3 = os.path.join(r"E:\devcode\kzsny\wmp", "wmp-uca-web-usm")
dir_path4 = os.path.join(r"E:\devcode\kzsny\wmp", "wmp-uca-web-login")
# 全生命周期管理
dir_path5 = os.path.join(r"E:\devcode\kzsny\wmp", "NewEnergy-web")
dir_path6 = os.path.join(r"E:\devcode\kzsny\wmp", "NewEnergy-web-business")
dir_path7 = os.path.join(r"E:\devcode\kzsny\wmp", "NewEnergy-web-usm")
# 后台
dir_path8 = os.path.join(r"E:\devcode\kzsny", "wmp-uca")
dir_path9 = os.path.join(r"E:\devcode\kzsny", "NewEnergy")

nowtime = datetime.datetime.now().strftime('%Y-%m-%d  %H:%M:%S')

dirArr = [dir_path1, dir_path2, dir_path3, dir_path4, dir_path5, dir_path6, dir_path7, dir_path8, dir_path9]

for it in dirArr:
    # p1 = subprocess.Popen('npm run start', shell=True, cwd=it, creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)
    # p1 = subprocess.Popen('npm run start', shell=True, cwd=it, creationflags=subprocess.CREATE_NEW_CONSOLE)
    # p1 = subprocess.Popen('npm run start',  cwd=it,creationflags=subprocess.CREATE_NEW_CONSOLE)
    p1 = subprocess.Popen('git pull',  shell=True, cwd=it)